<?php

//Crypt encode the password

function hasher($password, $encode=false)
{
	if ($encode)
	{
		if (crypt($password, $encode) == $encode)
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	else
	{
		//Let's make salt;
		$salt = '';
		for ($i=0; $i<10; $i++)
		{
    		$salt .= substr("./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", mt_rand(0, 63), 1);
    	}
    	$salt .= md5($password, true);
		return crypt($password, $salt);
	}
}